$(function () {
    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    });
    $("#tab-category").Huitab({
        index: 0
    });

    $("form").validate({
        rules: {
            title: {
                required: true,
            }
        },
        onkeyup: false,
        focusCleanup: true,
        success: "valid",
        submitHandler: function (form) {
            $("input[type='submit']").attr('disabled', true)
            $(form).ajaxSubmit({
                data: {
                    "sign": ""
                },
                success: function (data) {
                    data = $.parseJSON(data)
                    if (data.code == '1') {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        return;
                    }
                    layer.msg(data.message, {icon: 0, time: 1000});
                    $("input[type='submit']").attr('disabled', false);
                },
                error: function () {
                    alert("error")
                }
            });
        }
    });
});